<layout name='Layout/layout_profile' />
<script type="text/javascript">
	function check_password(s) {
		if (s.length < 4) {
			return 0;
		}
		var ls = 0;
		if (s.match(/[a-z]/ig)) {
			ls++;
		}
		if (s.match(/[0-9]/ig)) {
			ls++;
		}a
		if (s.match(/(.[^a-z0-9])/ig)) {
			ls++;
		}
		if (s.length < 6 && ls > 0) {
			ls--;
		}
		return ls
	}

	function save() {
		var msg = "";
		var vars = $("#form_password").serialize();
		sendAjax("{:U('reset_pwd')}", vars, function(data) {
			alert(data.info);
			setTimeout("myclose()", 200);
		});
	}


	$(document).ready(function() {
		$("#password").keydown(function() {
			s = $(this).val();
			t = check_password(s);
			if (t == 0) {
				$("#msg").html("密码过短");
				$("#msg").css("color", "red");
			}
			if (t == 1) {
				$("#msg").html("密码强度差");
				$("#msg").css("color", "red");
			}
			if (t == 2) {
				$("#msg").html("密码强度良好");
				$("#msg").css("color", "blue");
			}
			if (t == 3) {
				$("#msg").html("密码强度高");
				$("#msg").css("color", "blue");
			}
		})
		$("#confirm_password").keyup(function() {
			new_pwd = $("#password").val();
			confirm_pwd = $(this).val();
			if (new_pwd != confirm_pwd) {
				$("#msg").html("密码不一致");
				$("#msg").css("color", "red");
			} else {
				$("#msg").html("密码一致");
				$("#msg").css("color", "blue");
				$("#status").val("true");
			}
		})
	})
</script>
<div class="title panel panel-default">
	<div class="panel-body">
		<h3 class="col-md-12">修改密码</h3>
	</div>
</div>
<div class="operate panel panel-default">
	<div class="panel-body">
		<div class="pull-right">
			<a onclick="save()"  class="btn btn-default">保存</a>
		</div>
	</div>
</div>
<form id="form_password" method="post" action="" class="form-horizontal well">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<input type="hidden" name="user_id" id="user_id" value="{$id}">
	<div class="form-group">
		<label class="col-md-2 control-label" for="password">新密码：</label>
		<div class="col-md-10">
			<input class="form-control col-20" type="password" name="password" id="password" value=""  >
		</div>
	</div>
	<div class="form-group">
		<label class="col-md-2 control-label" for="list_rows">确认密码：</label>
		<div class="col-md-10">
			<input class="form-control col-20" text" id="list_rows" name="list_rows" value="{$config.list_rows}" check="number" msg="必须是数字">
		</div>
	</div>
</form>